Release 10.1A: OpenEdge Development:
Progress Dynamics Web Development Guide


SDO functions

You can create a function for a client-side SDO event by using the following naming convention:

SDOName_event() 

For event, you must use one of the following:

Event
Function description
add 
Executes after a record has been added.
copy 
Executes after a record has been copied.
delete 
Executes prior to a delete. Expects a return value.
dynLookup 
Executes before return from a dynamic lookup.
update 
Executes before validation.
validate 
Executes before validation. Expects a return value.
view 
Executes after data has been refreshed.

Example

The following example creates some customizations based on the value of city in the customer table:

// Sample Javascript include for Client-side SDO logic. 
// Colors the city field yellow for Nashua, but otherwise red 
function customerfullo_view(){ 
  window.document.all('customerfullo.city').style.backgroundColor= 
   (apph.action('customerfullo.city.get')=='Nashua'?'yellow':'red'); 
} 
// Sets some default values on add operation 
function customerfullo_add(){ 
  apph.action('customerfullo.name.set|default name'); 
  apph.action('customerfullo.address.set|default address'); 
  apph.action('customerfullo.city.set|Nashua'); 
} 
// same for copy as for add 
function customerfullo_copy(){ 
  customerfullo_add(); 
} 
// Special treatment of Nashua as value for city field both for validate and 
update 
var city_a; 
var city_b;  // being passed from validate to update so it must have outside 
scope 
function customerfullo_validate(){ 
  city_a=apph.action('customerfullo.city.old'); 
  city_b=document.all('customerfullo.city').value; 
  if(city_a=='Nashua'&&city_b!='Nashua'){ 
     alert('I will not let you do that because Nashua is my favorite city!'); 
     return false; 
  } 
  return true;     // Tells whether the operation was legal... 
} 
function customerfullo_update(){ 
  if(city_b!='Nashua') 
     apph.action('customerfullo.city.set|'+city_b+'=bad city'); 
} 
// Refuse to delete records where city is set to Nashua 
function customerfullo_delete(){ 
  if(apph.action('customerfullo.city.get')=='Nashua'){ 
    alert('I will not allow people from Nashua to go away'); 
    return false;  // Tells whether the operation was legal... 
  } 
  return true; 
} 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095